﻿using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Web;

namespace TO3.Models
{
    public class Match
    {
        public int Id { get; set; }
        
        [Display(Name = "Turnering")]
        public int TournamentId { get; set; }
        
        [Display(Name = "Spiller 1")]
        public int Player1Id { get; set; }
        
        [Display(Name = "Spiller 2")]
        public int Player2Id { get; set; }
        
        [Display(Name = "Bord Nr.")]
        public int TableId { get; set; }
        [Display(Name = "Runde")]
        public int Round { get; set; }
        public virtual Tournament Tournament { get; set; }
        public virtual Player Player1 { get; set; }
        public virtual Player Player2 { get; set; }
        
        #region Results
        [Display(Name = "Spiller 1 CP")]
        public int Player1CP { get; set; }
        
        [Display(Name = "Spiller 2 CP")]
        public int Player2CP { get; set; }
        [Display(Name = "Vinder")]
        public int? WinnerId { get; set; }
        public virtual Player Winner { get; set; }

        #endregion
        public Match(int tournamentId, int player1Id, int player2Id, int tableId, int round)
        {
            this.TournamentId = tournamentId;
            this.Player1Id = player1Id;
            this.Player2Id = player2Id;
            this.TableId = tableId;
            this.Round = round;
        }

        public Match()
        {
        }
    }
}